package com.tangyee.home_diet.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.tangyee.R;
import com.tangyee.home_diet.Uitls.BarTextColorUtils;

/** 食谱详细信息展示页
* @author: liuyaowen
* @date: 19-2-15 下午8:42
*/

public class RecipeDetailActivity extends AppCompatActivity {

    private BarTextColorUtils barTextColorUtils;
    private TextView productionMethod;
    private TextView recipeMain;
    private TextView recipeExcipient;
    private TextView recipeSeasoning;
    private TextView tips;
    private ImageView recipeImage;
    private TextView recipeTitle;
    private ImageView recipeDetailBack;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recipe_detail);
        //将状态栏设置成透明状态并且将文字设置为黑色
        barTextColorUtils = new BarTextColorUtils(RecipeDetailActivity.this);
        recipeImage = findViewById(R.id.recipe_image);
        productionMethod = findViewById(R.id.production_method);
        recipeMain = findViewById(R.id.recipe_main);
        recipeExcipient = findViewById(R.id.recipe_excipient);
        recipeSeasoning = findViewById(R.id.recipe_seasoning);
        tips = findViewById(R.id.tips);
        recipeTitle = findViewById(R.id.recipe_title);
        recipeDetailBack = findViewById(R.id.recipe_detail_back);
        Intent intent = getIntent();
        String imageAddress = intent.getStringExtra("recipe_image");
        recipeTitle.setText(intent.getStringExtra("recipe_name"));
        Glide.with(getApplicationContext())
                .load(imageAddress)
                .into(recipeImage);
        productionMethod.setText(intent.getStringExtra("production_method"));
        recipeMain.setText(intent.getStringExtra("recipe_main"));
        recipeExcipient.setText(intent.getStringExtra("recipe_excipient"));
        recipeSeasoning.setText(intent.getStringExtra("recipe_seasonging"));
        tips.setText(intent.getStringExtra("tips"));

        recipeDetailBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
